package com.jianganming.template.jdbc.framework;

import com.mysql.jdbc.Driver;

import java.sql.*;

public class DataSource {

    private String url;
    private String userName;
    private String password;

    public void setUrl(String url) {
        this.url = url;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    static {
        try {
            Class.forName(Driver.class.getName());
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }

    public Connection getConnection() throws SQLException {
        return DriverManager.getConnection(url,userName,password);
    }
}
